package cn.gson.springboot.model.pojos;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Objects;

@Entity
public class Returnlist {
    private int returnlistId;;
    private String returnlistNote;
    private Integer returnlistNum;
    private String returnlistReason;
    private BigDecimal returnlistAmount;
    private String returnlistName;
    private Return returnByReturnId;

    @Id
    @Column(name = "returnlist_id", nullable = false)
    public int getReturnlistId() {
        return returnlistId;
    }

    public void setReturnlistId(int returnlistId) {
        this.returnlistId = returnlistId;
    }


    @Basic
    @Column(name = "returnlist_note", nullable = true, length = 255)
    public String getReturnlistNote() {
        return returnlistNote;
    }

    public void setReturnlistNote(String returnlistNote) {
        this.returnlistNote = returnlistNote;
    }

    @Basic
    @Column(name = "returnlist_num", nullable = true)
    public Integer getReturnlistNum() {
        return returnlistNum;
    }

    public void setReturnlistNum(Integer returnlistNum) {
        this.returnlistNum = returnlistNum;
    }

    @Basic
    @Column(name = "returnlist_reason", nullable = true, length = 255)
    public String getReturnlistReason() {
        return returnlistReason;
    }

    public void setReturnlistReason(String returnlistReason) {
        this.returnlistReason = returnlistReason;
    }

    @Basic
    @Column(name = "returnlist_amount", nullable = true, precision = 2)
    public BigDecimal getReturnlistAmount() {
        return returnlistAmount;
    }

    public void setReturnlistAmount(BigDecimal returnlistAmount) {
        this.returnlistAmount = returnlistAmount;
    }

    @Basic
    @Column(name = "returnlist_name", nullable = true, length = 255)
    public String getReturnlistName() {
        return returnlistName;
    }

    public void setReturnlistName(String returnlistName) {
        this.returnlistName = returnlistName;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Returnlist that = (Returnlist) o;
        return returnlistId == that.returnlistId &&
                Objects.equals(returnlistNote, that.returnlistNote) &&
                Objects.equals(returnlistNum, that.returnlistNum) &&
                Objects.equals(returnlistReason, that.returnlistReason) &&
                Objects.equals(returnlistAmount, that.returnlistAmount) &&
                Objects.equals(returnlistName, that.returnlistName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(returnlistId, returnlistNote, returnlistNum, returnlistReason, returnlistAmount, returnlistName);
    }

    @ManyToOne
    @JoinColumn(name = "return_id", referencedColumnName = "return_id")
    public Return getReturnByReturnId() {
        return returnByReturnId;
    }

    public void setReturnByReturnId(Return returnByReturnId) {
        this.returnByReturnId = returnByReturnId;
    }
}
